#define _CRT_SECURE_NO_WARNINGS 1
#include<string.h>
#include<stdbool.h>
bool checkPalindromeFormation(char* a, char* b)
{
    char* ay = a, * by = b;
    int len = strlen(a);
    char* aTail = a + len - 1, * bTail = b + len - 1;
    int stop = 0;
    while (*a == *bTail)
    {
        ++ay;
        --bTail;
        ++stop;
    }
    char* bhead = &b[stop];
    while (*bhead == *bTail && (stop + 1) * 2 <= len)
    {
        bhead++;
        bTail--;
        stop++;
    }
    if (bhead >= bTail)
        return true;
    stop = 0;
    while (*b == *aTail)
    {
        ++b;
        --aTail;
        ++stop;
    }
    char* ahead = &a[stop];
    while (*ahead == *aTail)
    {
        ahead++;
        aTail--;
    }
    if (ahead >= aTail)
        return true;
    return false;
}

int main()
{
    char* a = "ulacfddd";
    char* b = "ddjizalu";
    checkPalindromeFormation(a, b);
    return 0;
}